package com.seanchenxi.gwt.wordpress.xmlrpc.service.model.handler;

import java.util.ArrayList;

import com.seanchenxi.gwt.wordpress.xmlrpc.service.model.impl.ModelFactory;
import com.seanchenxi.gwt.xmlrpc.client.impl.BaseResponseHandler;

public class StatusResponseHandler extends BaseResponseHandler<ArrayList<String>>{
	@Override
	public ArrayList<String> handleResponse(String response) {
		Object object = super.handleResponse(response);
		
		if(ModelFactory.isNotPropertyMap(object)) return null;
		
		ArrayList<String> s = new ArrayList<String>();
		for(Object obj : ModelFactory.castToMap(object).values()){
			if(obj instanceof String && !s.contains(obj)){
				s.add(String.valueOf(obj));
			}
		}
		return s;
	}
}
